package com.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dao.DepDAO;
import com.pojo.Dep;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.solr.core.SolrTemplate;
import org.springframework.stereotype.Service;

import java.time.Duration;
import java.util.List;

@Service
public class DepService extends ServiceImpl<DepDAO, Dep> {

    @Autowired
    private SolrTemplate solrTemplate;

    public void addSolr()
    {
        List list = super.list();
        System.out.println(list);
        solrTemplate.saveBeans("new_core",list, Duration.ofDays(10));
        solrTemplate.commit("new_core");


    }



}
